package com.example.second.chain;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.example.second.R;
import com.example.second.chain.classes.ConcreteHandler1;
import com.example.second.chain.classes.ConcreteHandler2;
import com.example.second.chain.classes.ConcreteHandler3;

public class ChainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chain);

        ConcreteHandler1 concreteHandler1 = new ConcreteHandler1();
        ConcreteHandler2 concreteHandler2 = new ConcreteHandler2();
        ConcreteHandler3 concreteHandler3 = new ConcreteHandler3();
        concreteHandler1.setNext(concreteHandler2);
        concreteHandler2.setNext(concreteHandler3);

        concreteHandler1.handleRequest("five");
    }
}